package com.lazycat.backend.controller.user;


import com.alibaba.fastjson.JSONObject;
import com.lazycat.backend.service.impl.user.FetchUserOrdersServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class FetchUserOrdersController {

    @Autowired
    private FetchUserOrdersServiceImpl fetchUserOrdersService;

    @PostMapping("order/fetch/")
    public JSONObject fetch (@RequestBody Map<String,String> map) {
        Integer userId = Integer.parseInt(  map.get("user_id"));
        return fetchUserOrdersService.fetch(userId);
    }

}
